package cn.factorybox.model.entity;

import com.fasterxml.jackson.annotation.*;
import org.hibernate.validator.constraints.Length;

import java.io.Serializable;
import java.util.Date;

/**
 * @author flypig
 * @version 1.0
 * @dae 2019-11-25 16:24
 */


//@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonIgnoreProperties(value = {"uCreateTime"})
public class User implements Serializable {

    private static final long serialVersionUID = 1L;
    private String id;      //用户id

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty("oldpassword")
    private String oldPassword; // 旧密码

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty("newpassword")
    private String newPassword; // 新密码

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty("name")
    private String cName;   //公司名称

    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String companyId;   //公司id

    @JsonProperty("username")
    @Length(min = 4, max = 30, message = "用户名只能在4~30位之间")
    private String uName;   //用户名称

    @Length(min = 4, max = 30, message = "密码只能在4~30位之间")
    @JsonIgnore
    private String uPass;    // 用户密码

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date uCreateTime;       // 创建日期

    @JsonProperty("phone")
    private String uPhone;       //用户联系方式

    @JsonProperty("email")
    private String uEmail;         //用户邮箱

    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String uRemark;        // 备注信息

    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String uHeadpath;      // 头像地址

    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String uNickname;      // 用户昵称

    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Integer number;         // 旗下公司成员数，包含子用户和主管

    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String roles;

    @JsonIgnore
    private String salt;

    public String getcName() {
        return cName;
    }

    public void setcName(String cName) {
        this.cName = cName;
    }

    public String getOldPassword() {
        return oldPassword;
    }

    public void setOldPassword(String oldPassword) {
        this.oldPassword = oldPassword;
    }

    public String getNewPassword() {
        return newPassword;
    }

    public void setNewPassword(String newPassword) {
        this.newPassword = newPassword;
    }

    public String getCompanyId() {
        return companyId;
    }

    public void setCompanyId(String companyId) {
        this.companyId = companyId;
    }

    public String getuEmail() {
        return uEmail;
    }

    public void setuEmail(String uEmail) {
        this.uEmail = uEmail;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getuName() {
        return uName;
    }

    public void setuName(String uName) {
        this.uName = uName;
    }

    public String getuPass() {
        return uPass;
    }

    public void setuPass(String uPass) {
        this.uPass = uPass;
    }

    public Date getuCreateTime() {
        return uCreateTime;
    }

    public void setuCreateTime(Date uCreateTime) {
        this.uCreateTime = uCreateTime;
    }

    public String getuPhone() {
        return uPhone;
    }

    public void setuPhone(String uPhone) {
        this.uPhone = uPhone;
    }

    public String getuRemark() {
        return uRemark;
    }

    public void setuRemark(String uRemark) {
        this.uRemark = uRemark;
    }

    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    public String getuHeadpath() {
        return uHeadpath;
    }

    public void setuHeadpath(String uHeadpath) {
        this.uHeadpath = uHeadpath;
    }

    public String getuNickname() {
        return uNickname;
    }

    public void setuNickname(String uNickname) {
        this.uNickname = uNickname;
    }

    public String getRoles() {
        return roles;
    }

    public void setRoles(String roles) {
        this.roles = roles;
    }

    public Integer getNumber() {
        return number;
    }

    public void setNumber(Integer number) {
        this.number = number;
    }

    @Override
    public String toString() {
        return "User{" +
                "id='" + id + '\'' +
                ", uName='" + uName + '\'' +
                ", uPass='" + uPass + '\'' +
                ", uCreateTime=" + uCreateTime +
                ", uContact='" + uPhone + '\'' +
                ", uEmail='" + uEmail + '\'' +
                ", uRemark='" + uRemark + '\'' +
                ", uHeadpath='" + uHeadpath + '\'' +
                ", uNickname='" + uNickname + '\'' +
                ", roles='" + roles + '\'' +
                ", salt='" + salt + '\'' +
                '}';
    }
}
